#!/usr/bin/ruby
# -*- ruby -*-
#
# http://programmingpraxis.com/2012/10/09/two-word-games/
#
# part 1

(ARGV.empty? ? [File.basename($0).gsub(/\-first.rb$/, '.input')] : ARGV).each do |dict|
  File.open(dict) do |fh|
    while w = fh.gets
      w.strip!

      # Without regular expressions ...
      next unless w.size >= 5

      vowels = w.split(//).select { |c| 'aeiou'.include?(c) }

      puts w if vowels.join('') == 'aeiou'
    end
  end
end
